<?
require_once 'config.php';
$url = $_SERVER['REQUEST_URI'];
if(preg_match('/\?page=/',$url)){
   $current_page =(int) preg_replace('/^.+page=/','',$url);
}
if(!is_int($current_page)) $current_page = 1;
if(gettype($current_page) != "integer") $current_page = 1;
if($current_page <0 || !$current_page) $current_page = 1;
$templateBlog = new TemplateBlog();
$templateBlog->page_size = 8;
$templateBlog->page = $current_page;
$blog = $templateBlog->blog();
$total = $templateBlog->blog_total();
?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
"http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html>
<head>
<title>Blog</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<link href="/home/css/style.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="wrap"> 	
   <? include 'includes/inc_header.php'?>	
	<div class="about-top">
		<div class="about-box">
			    <div class="ser_cat_box">
					<h2 class="ser_cat_box_title">Blog</h2>
					<div class="grid_img">
					    <?
                     if($blog){
                     foreach($blog as $row){
                  ?>
                     <div class="post_one">
                        <div class="image_post">
                           <img src="<?=W_DOMAIN.blog_img.'medium_'.$row['blo_picture']?>"/>
                        </div>
                        <div class="post_info">
                           <a href="<?=generate_blog_detail_url($row)?>"><p class="post_title"><?=$row['blo_title']?> </p></a>
                           <p class="post_date"><?=getDateTime(1,1,1,1,'',$row['blo_date'])?></p>
                           <p class="post_description"><?=cut_string($row['blo_summary'],100)?>... <a href="<?=generate_blog_detail_url($row)?>">Đọc thêm</a></p>
                        </div>
                     </div>
                  <?
                     }}else echo "Chưa có dịch vụ!"
                  ?>
                  <div class="services_pagebreak">
                     <?=generatePageBar('',$current_page,$templateBlog->page_size,$total,'','main_page_btn','page_selected','<<','>>','Đầu','Cuối',1,1)?>
                  </div>
					</div>
				 </div>
				 <div class="clear"></div> 	
			</div>
		 </div>
	 <div class="footer">
	    <? include 'includes/inc_footer.php'?>	
	</div>
   </div>
</body>
</html>